#include "qsolver.h"

QSolver::QSolver(QObject *parent) :
        QThread(parent)
{
}

void QSolver::setField(const solver::Field &f)
{
    field = f;
}

bool strlen_comp(const solver::WordStack &str1, const solver::WordStack &str2)
{
    return str1.first.length() > str2.first.length();
}

void QSolver::run()
{
    result.clear();
    solver::FindAllWords(field, result);
    sort(result.begin(), result.end(), strlen_comp);
}

const solver::Words &QSolver::getResult()
{
    return result;
}
